<?php
/*
 * Created on 2012-7-7
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
?>
<script type='text/javascript'>
	$(function(){
		$("#submit_comment").one('click',function(){$('form:first').submit()});
		function get_captcha(){
			$captcha = "<?php echo site_url();?>/background/common_c/captcha";
			$.ajax({
			  type:"POST",
			  url: $captcha,
			  cache: false,
			  success:function(img){
			   	$('#captcha').html(img);
			  }
			});
		}
		$("#captcha").click(function(){get_captcha();});
		get_captcha();
	})
</script>
<div id="left">
    		 <div Class="post">
    		 <!-- 文章列表-->
				<?php foreach($articles as $article):?>
    				<h3><strong><?php echo anchor(site_url()."/article/$article->id",$article->title)?></strong></h3>
    				<h4 class="metadata">
							<span>发布于: <?php echo $article->publish_date?></span>
							<span>分类: <?php echo common::_get_category_name($article->category_tree,"/category/")?></span>
							<span class="no-border">作者: <?php echo anchor(site_url()."/author/$article->username",$article->username)?></span>
						</h4>
					<div class="content">
						<?php echo $article->content?>
					</div>
					<div class="replay">
						回复作者
					</div>
				<?php endforeach;?>
				<?php $this->load->view('common/comment.php')?>
				<?php if($this->session->userdata('username')):?>
				<div id="replay_article">

				 <form  action="<?php echo site_url().'/background/add_comment'?>" method="post">
				 	<input type='hidden' name='action' id='replay_form' value="<?php echo site_url().'/background/add_comment'?>" />
					<input type="hidden" name="article_id" value="<?php echo $article->id;?>"/>
 					<input type="hidden" name="current_url" value="<?php echo current_url();?>"/>
				  <span class="replay_content"></span>
				  <textarea name="content" rows="10" cols="50" wrap="off">

					</textarea>
					<br/>
					<ul class='replay_bottom'>
						<li> <input type="text" name="captcha" value="" size="10" maxlength="10"/></li>
						<li id='captcha'></li>
						<li><input type="button" id ="submit_comment" name="replay" value="回复" /></li>
  					<ul>
				  </form>
				</div>
			<?php else: ?>
				<div id="can_not_replay">
					尚未登录，不能进行评论。
				</div>
			<?php endif;?>

</div>
